module.exports = {
	//做题页面,状态码处理[0=Text(文本)],[1=Image(图片)],[2=Audio(音频)],[3=Video(视频)],[4=RichText(富文本)],[5=MarkDown(MarkDown)]
	httpStatusCode_(status, val) {
		let errorOptions = {
			icon: "none",
		}
		var that = this;
		switch (status) {
			case 400:
				errorOptions.title = '错误请求';
				break
			case 401:
				errorOptions.title = '未授权，请重新登录';
				break
			case 403:
				errorOptions.title = '拒绝访问';
				break
			case 404:
				errorOptions.title = '请求错误,未找到该资源';
				break
			case 405:
				errorOptions.title = '请求方法未允许';
				break
			case 408:
				errorOptions.title = '请求超时';
				break
			case 500:
				errorOptions.title = '服务器端出错';
				break
			case 501:
				errorOptions.title = '网络未实现';
				break
			case 502:
				errorOptions.title = '网络错误';
				break
			case 503:
				errorOptions.title = '服务不可用';
				break
			case 504:
				errorOptions.title = '网络超时';
				break
			case 505:
				errorOptions.title = 'http版本不支持该请求';
				break
			default:
				errorOptions.title = `连接错误${error.response.status}`;
		}
		uni.showToast(errorOptions);
	},
	filterCode_(code, val) {
		var that = this;
		const status = {
			//临时处理，为文本时，都为md
			0: decodeURIComponent(val), //文本，解码返回
			1: that.judgeAddress(val) + "?id=" + this.randomString(), //图片
			2: that.judgeAddress(val) + "?id=" + this.randomString(), //音频
			3: that.judgeAddress(val) + "?id=" + this.randomString(), //视频
			4: decodeURIComponent(val), //富文本，解码返回
			5: that.filterMarked_(val)
		}
		return status[code]
	},
}
